home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Gigantic Games 2
/
Gigantic Games 2.iso
/
pc
/
_b_
/
blackjacktrainer
/
bj_trainer.amos
/
bj_trainer.amosSourceCode
< prev
next >
Wrap
AMOS Source Code
|
1994-12-23
|
34KB
|
1,171 lines
'* BLACK TRAINER *
'* by Peter Cartwright *
'* written in AMOS *
'***************************
Set Buffer 10
Screen Open 0,320,200,16,Lowres
Dim TLX(3),TLY(3),BRX(3),BRY(3)
Dim HARD_DBL(3,10),SOFT_DBL(8,10),HARD_HIT(6,10),SOFT_HIT(4,10),SPLIT(10,10)
Dim CARD_PACK$(208),NUM_OF_ACES(3),SOFT(3),PL4YER_COUNT(2)
Dim PL4YERX(2),BUST(2),STAKE(2),DUBBLED(2),LINE$(3),BUTTON$(3),SPEED_ARR$(3)
Global STAKE(),HAND,BLUE_CHIPS,RED_CHIPS,B0B,BANK,PL4YER_COUNT(),DEALER_COUNT
Global NUM_OF_ACES(),SOFT(),POS,HAND,OWES_50P
Global A$,FILELEN,RMARGIN,LMARGIN
BOTTOM_CARD=197-(Rnd(8))
T0P_CARD=0 : SPEED=7 : Set Talk 0,0,110, : Say "Blackjack Trainer."
_LOAD_ARRAY
PL4YERX(1)=208 : PL4YERX(2)=110 : PL4YERY=36 : DEALERX=132 : DEALERY=0
RESTART=True
FRONT_END
'++++++++++++++++++++++++++
'+ Blackjack Starts Here +
'++++++++++++++++++++++++++
MAIN:
Auto View Off
Screen Open 0,320,200,32,Lowres
Flash Off
Curs Off
Limit Mouse 128,44 To 444,240
'Load Iff "Dh0:dpaint/lo-res/table",0
'Follow
Unpack 6 To 0
Fade 1 : Wait 15
Auto View On
Screen Display 0,128,42,,
Fade 3,0,$FFF,$C00,$93,$A,$EF0,$F77,$E4F,$F0C,$A0F,$0,$FED,$FE0,$CCC,$888,$444
Wait 45
Get Sprite Palette
Double Buffer
Reserve Zone 7
SET_ZONES
AN$="A 6,(64,8)(65,8)"
RMARGIN=4 : LMARGIN=0 : Rem Margins for text reader
Ink 2,3
BANK=200
MAKE_PACK
SHUFFLE
ST4RT:
HAND=1
B0B=1
For I=1 To 2
BUST(I)=False : DUBBLED(I)=False
Next I
SPLIT=False
HAND_FINISHED=False
SPLIT_POSSIBLE=False
POS=0
For I=1 To 3
NUM_OF_ACES(I)=0
SOFT(I)=False
Next I
PLACE_BET
' PLACE_BET uses bobs 1 and 2 for original bet
' bobs 3 and 4 are used split
' bobs 5 to 8 are used for doubles
If RESTART=True : Rem Esc pressed in PLACE_BET
Sprite Off 1
FRONT_END
Goto MAIN
End If
STAKE(HAND)=BET
' Deal 2 cards to player and 1 to dealer
PL0FFSETX=PL4YERX(HAND) : PL0FFSETY=PL4YERY
B0B=8 : Rem B0B is now 8 and DEAL_CARD adds 1 more to start at 9.
DEAL_CARD : ADJUST_HAND[HAND]
Wait SPEED
PL4YER_COUNT(HAND)=RANK
PL0FFSETX=DEALERX : PL0FFSETY=DEALERY
DEAL_CARD : Inc POS
Wait SPEED
ADJUST_HAND[3]
DEALER_COUNT=RANK
PL0FFSETX=PL4YERX(HAND) : PL0FFSETY=PL4YERY
DEAL_CARD : Inc POS
ADJUST_HAND[HAND]
' Check for split - 2 tens is a bad split so is not offered
' thus saving a lot of progamming to sort out picture cards!
If PL4YER_COUNT(HAND)=RANK and RANK<>10 and SPLIT=False
SPLIT_POSSIBLE=True
Say "You may split if you wish."
End If
PL4YER_COUNT(HAND)=PL4YER_COUNT(HAND)+RANK
If PL4YER_COUNT(HAND)=21
Say " blackjack."
PL4YER_COUNT(HAND)=99
HAND_FINISHED=True
End If
ADVICE_GIVEN=False
While HAND_FINISHED=False
If HELPME
If Not ADVICE_GIVEN
HELP
ADVICE_GIVEN=True
End If
End If
Repeat
NEWZONE=Mouse Zone
If Key State(95)=True Then HELP
' Esc has been pressed
If Key State(69)=True
Fade 3 : Wait 50
Sprite Off 1
RESTART=True
FRONT_END
Goto MAIN
End If
Until Mouse Click and NEWZONE<>0
If NEWZONE=1
HAND_FINISHED=True
End If
If NEWZONE=2
DEAL_CARD : Inc POS
ADVICE_GIVEN=False
ADJUST_HAND[HAND]
PL4YER_COUNT(HAND)=PL4YER_COUNT(HAND)+RANK
'If bust, check for any fresh aces.
If PL4YER_COUNT(HAND)>21 and NUM_OF_ACES(HAND)>0
Dec NUM_OF_ACES(HAND)
PL4YER_COUNT(HAND)=PL4YER_COUNT(HAND)-10
If NUM_OF_ACES(HAND)=0 : Rem only one unaccounted for ace was present
SOFT(HAND)=False
End If
End If
If PL4YER_COUNT(HAND)>21 and PL4YER_COUNT(HAND)<>99
Wait SPEED
Say " Bust."
HAND_FINISHED=True
BUST(HAND)=True
TAKE_MONEY
If Not SPLIT
Bob Off : Wait Vbl
Goto ST4RT
End If
End If
If PL4YER_COUNT(HAND)=21
Say "player has twenty one."
Wait SPEED
HAND_FINISHED=True
End If
Wait SPEED : Rem avoid double hit?
End If
If NEWZONE=3 and SPLIT_POSSIBLE=True and SPLIT=False
_SPLIT_PROC
End If
' If the hand is soft (SOFT*10) will equal -10
If NEWZONE=4 and PL4YER_COUNT(HAND)+(SOFT(HAND)*10)<12 and POS=2
_D0UBLE_PROC
End If
If SPLIT=True and HAND=1 and HAND_FINISHED=True
HAND_FINISHED=False
Inc HAND
POS=2
PL0FFSETX=PL4YERX(HAND)
Channel 1 To Bob 30
AM$="Move -100,0,35"
Amal 1,AM$ : Amal On
While Chanmv(1)
Wend
Bell
Wait 40
ADVICE_GIVEN=False
End If
Wend
' If both hands bust, no need for dealer to deal
If BUST(1) and BUST(2)
Bob Off : Wait Vbl
Goto ST4RT
End If
' If player has blackjack, check to see if dealer can get one
If PL4YER_COUNT(HAND)=99
If DEALER_COUNT<>11 and DEALER_COUNT<>10
PAY_SIX_TO_4
Bob Off : Wait Vbl
Goto ST4RT
End If
End If
POS=1
While DEALER_COUNT<17
PL0FFSETX=DEALERX : PL0FFSETY=DEALERY
DEAL_CARD : Inc POS
Wait SPEED
ADJUST_HAND[3]
DEALER_COUNT=DEALER_COUNT+RANK
' Check for a dealer blackjack
If DEALER_COUNT=21 and POS=2
Say " Dealer gets blackjack."
If PL4YER_COUNT(HAND)=99
Say " Standoff."
BANK=BANK+STAKE(HAND)
CLAIM_STAKE
Else
Say " Dealer wins."
TAKE_MONEY
End If
Bob Off : Wait Vbl
Goto ST4RT
End If
If PL4YER_COUNT(HAND)=99 and POS=2
Say " player wins."
PAY_SIX_TO_4
Bob Off : Wait Vbl
Goto ST4RT
End If
'Before adjusting "soft" hands, check to see if it is between 16 & 22
If DEALER_COUNT>16 and DEALER_COUNT<22 and NUM_OF_ACES(3)>0 Then Exit
'ADJUST "soft"HAND If BUST
If DEALER_COUNT>21 and NUM_OF_ACES(3)>0
Dec NUM_OF_ACES(3) : Rem Adjustment made so cancel this ace.
DEALER_COUNT=DEALER_COUNT-10
End If
Wend
' Who's won?
If Not SPLIT
If DEALER_COUNT>21
Say " Dealer Busts."
PAY_EVENS
Bob Off : Wait Vbl
Goto ST4RT
End If
If DEALER_COUNT>PL4YER_COUNT(HAND)
Say " Dealer wins."
TAKE_MONEY
Wait 30
Bob Off : Wait Vbl
Goto ST4RT
End If
If DEALER_COUNT=PL4YER_COUNT(HAND)
Say " Stand Off."
BANK=BANK+STAKE(HAND)
CLAIM_STAKE
Bob Off : Wait Vbl
Goto ST4RT
End If
Say " player wins."
PAY_EVENS
Bob Off : Wait Vbl
Goto ST4RT
Else
If DEALER_COUNT>21
Say " dealer busts."
For HAND=1 To 2
If BUST(HAND)=False
Say " pay hand "+Str$(HAND)+"."
PAY_EVENS
End If
Next HAND
Bob Off
Goto ST4RT
End If
For HAND=1 To 2
If DEALER_COUNT>PL4YER_COUNT(HAND) and BUST(HAND)=False
Say " Dealer wins hand"+Str$(HAND)+"."
TAKE_MONEY
Wait 30
If HAND=2
Bob Off : Wait Vbl
End If
End If
If DEALER_COUNT<PL4YER_COUNT(HAND) and BUST(HAND)=False
Say " Player wins hand"+Str$(HAND)+"."
PAY_EVENS
If HAND=2
Bob Off : Wait Vbl
End If
End If
If DEALER_COUNT=PL4YER_COUNT(HAND) and BUST(HAND)=False
Say "Standoff on hand"+Str$(HAND)+"."
BANK=BANK+STAKE(HAND)
CLAIM_STAKE
If HAND=2
Bob Off : Wait Vbl
End If
End If
Next HAND
Bob Off : Wait Vbl
Goto ST4RT
End If
Procedure ADJUST_HAND[N]
Shared RANK,NUM_OF_ACES()
If RANK>10 Then RANK=10
If RANK=1 Then RANK=11
If RANK=11
Inc NUM_OF_ACES(N)
SOFT(N)=True
End If
End Proc
' Thanks to Sprite editor for this Proc.
Procedure ALERT[W,H,C1,C2,NB,NL]
Shared Q,LINE$(),BUTTON$()
Reserve Zone 3
W=W*8
H=H*8
X=160-W/2
Y=50-H/2
Get Block 1,X,Y,W+16,H+16
Ink 0
Bar X+5,Y+5 To X+W+5,Y+H+5
Ink C1
Bar X,Y To X+W,Y+H
Ink C2
Box X+1,Y+1 To X+W-1,Y+H-1
S=W/8/(NB+1)+1
Paper C1
Pen C2
Curs Off
A=0 : While A<NB
Locate X Text(X)+S/2+S*A,Y Text(Y+H)-2
Print Border$(Zone$(BUTTON$(A),1+A),2);
Inc A : Wend
A=0 : While A<NL
Locate 0,Y Text(Y)+1+A
Centre LINE$(A)
Inc A
Wend
Q=0
While Q=0
While Mouse Key=0 : Wend
Z=Mouse Zone
If Z<1 or Z>1+NB
Bell
Else
Q=Z
End If
Wend
Put Block 1,X,Y
End Proc
Procedure CLAIM_STAKE
Shared DUBBLED()
TEMP_FL=DUBBLED(HAND)
If HAND=2 Then HAND=3
Channel 1 To Bob HAND
Channel 2 To Bob HAND+1
AM$="Move 0,40,25"
If BLUE_CHIPS>0
Amal 1,AM$
End If
If RED_CHIPS>0
Amal 2,AM$
End If
If TEMP_FL and BLUE_CHIPS>0
Channel 3 To Bob HAND+4 : Amal 3,AM$
End If
If TEMP_FL and RED_CHIPS>0
Channel 4 To Bob HAND+5 : Amal 4,AM$
End If
If HAND=3 Then HAND=2
Amal On
While Chanmv(1) or Chanmv(2) or Chanmv(3) or Chanmv(4)
Wend
Wait 35
End Proc
Procedure DEAL_CARD
Shared CARD_PACK$(),SUIT,RANK,T0P_CARD,BOTTOM_CARD
Shared PL0FFSETX,PL0FFSETY
Inc B0B
Inc T0P_CARD :
If T0P_CARD=BOTTOM_CARD
SHUFFLE
Text 0,0," "
T0P_CARD=1
BOTTOM_CARD=197-Rnd(8)
End If
SUIT=Val(Left$(CARD_PACK$(T0P_CARD),2))
RANK=Val(Right$(CARD_PACK$(T0P_CARD),2))
Bob B0B,POS*8+PL0FFSETX,POS*8+PL0FFSETY,9+(SUIT*13)+RANK
Sam Play 1,2,4000
Wait 2
End Proc
Procedure _D0UBLE_PROC
Shared DUBBLED(),HAND_FINISHED,RANK
BANK=BANK-STAKE(HAND)
DUBBLED(HAND)=True
Text 200,186,"�"+Str$(BANK)
STAKE(HAND)=STAKE(HAND)*2
Channel 1 To Bob 5
Channel 2 To Bob 6
If HAND=2
HAND=3
Channel 1 To Bob 7
Channel 2 To Bob 8
End If
If BLUE_CHIPS>0
Bob HAND+4,160,186,I Bob(1)
Wait Vbl
AM$="Move -"+Str$(160-X Bob(HAND)+20)+",-"+Str$(186-Y Bob(HAND))+",20"
Amal 1,AM$
End If
If RED_CHIPS>0
Bob HAND+5,160,186,I Bob(2)
Wait Vbl
AM$="Move -"+Str$(160-X Bob(HAND+1)+20)+",-"+Str$(186-Y Bob(HAND+1))+",20"
Amal 2,AM$
End If
If HAND=3
HAND=2
End If
Amal On
While Chanmv(1) or Chanmv(2)
Wend
Wait 35
DEAL_CARD
Wait 20
ADJUST_HAND[HAND]
PL4YER_COUNT(HAND)=PL4YER_COUNT(HAND)+RANK
' If over 21 an ace has been drawn to 11, so reduce by 10
If PL4YER_COUNT(HAND)>21
PL4YER_COUNT(HAND)=PL4YER_COUNT(HAND)-10
End If
HAND_FINISHED=True
End Proc
Procedure FRONT_END
Shared RESTART,T0P_CARD,SPEED,SPEED$,SPEED_ARR$()
Shared LINE$(),BUTTON$(),Q,HELPME
Do
If RESTART=True
RESTART=False
T0P_CARD=0
Clear Key
Fade 3 : Wait 45
Auto View Off
Screen Open 1,320,200,32,Lowres
Fade 1 : Wait 15
'Load Iff "workbench:dpaint/lo-res/jack_title"
Auto View On
Unpack 7 To 1
Flash Off
Fade 3,,,,,,,,,,,,,,,,,,,$940,$111,$222,$333,$444,$555,$666,$777,$888,$999,$AAA,$BBB,$CCC,$DDD
Wait 45
Fade 3,0,$FFF,$C00,$93,$A,$EF0,$F77,$E4F,$F0C,$A0F,$0,$FED,$FE0,$CCC,$888,$444
Wait 45
Menu$(1)="Details "
Menu$(2)="Options "
Menu$(3)="Info. "
'Details
Menu$(1,1)="Credits "
'options
Menu$(2,1)="Play with Help "
Menu$(2,2)="Play without Help "
Menu$(2,3)="Set Speed "
Menu$(2,4)="Quit "
'Rules
Menu$(3,1)="How to Play. "
Menu$(3,2)="House Rules. "
Menu$(3,3)="Basic Strategy. "
Menu$(3,4)="Card Counting. "
Menu On
End If
If Choice
FL=0
If Choice(1)=1 and Choice(2)=1
_PROCESS["details"]
End If
If Choice(1)=2
If Choice(2)=1
HELPME=True
FL=1
Menu Off
End If
If Choice(2)=2
HELPME=False
FL=1
Menu Off
End If
If Choice(2)=3
SPEED$=SPEED_ARR$((SPEED-4)/3-1)
LINE$(0)="Select a Speed"
LINE$(1)="Current Speed "+SPEED$
BUTTON$(0)="Fast"
BUTTON$(1)="Med."
BUTTON$(2)="Slow"
Menu Off
ALERT[22,8,1,2,3,2]
SPEED=Q*3+4
Menu On
End If
If Choice(2)=4
End
End If
If FL=1
Fade 2,,,,,,,,,,,,,,,,,,,$FFF,$EEF,$DDF,$CCF,$BBE,$AAE,$99D,$88D,$77C,$66C,$55B,$44B,$33B,$22A
Wait 18*1
Fade 2 : Rem Wait 32
Pop Proc : Rem This is the only way out of here!
End If
End If
If Choice(1)=3
If Choice(2)=1
_PROCESS["_instruct"]
End If
If Choice(2)=2
_PROCESS["rules"]
End If
If Choice(2)=3
_PROCESS["strategy"]
End If
If Choice(2)=4
_PROCESS["count"]
End If
End If
End If
Loop
End Proc
Procedure HARD_D0UBLE_HELP
Shared HARD_DBL(),SOFT_DBL(),HARD_HIT(),SOFT_HIT(),SPLIT(),D0UBLE
' 271 to 300 hard_dbl
_OFFSET=269
PL4Y=12-PL4YER_COUNT(HAND) : DEAL=DEALER_COUNT-1
SEL=Peek(Start(8)+_OFFSET+(PL4Y-1)*10+DEAL)
If SEL=1
LIGHT[4]
D0UBLE=True
End If
End Proc
Procedure HARD_HIT_HELP
Shared HARD_DBL(),SOFT_DBL(),HARD_HIT(),SOFT_HIT(),SPLIT(),D0UBLE
' 41 to 100 HARD_HIT
_OFFSET=39
If PL4YER_COUNT(HAND)<12
LIGHT[2]
Pop Proc
End If
If PL4YER_COUNT(HAND)<17
PL4Y=18-PL4YER_COUNT(HAND) : DEAL=DEALER_COUNT-1
SEL=Peek(Start(8)+_OFFSET+(PL4Y-1)*10+DEAL)
If SEL=1
LIGHT[2]
Else
LIGHT[1]
End If
Else
LIGHT[1]
End If
End Proc
Procedure HELP
Shared HARD_DBL(),SOFT_DBL(),HARD_HIT(),SOFT_HIT(),SPLIT(),SPLIT_POSSIBLE
Shared POS,SPL1T,D0UBLE
If POS=2 : Rem Splits and Doubles only on 3rd card
'first look for splits
SPL1T=False
If SPLIT_POSSIBLE and HAND=1
SPLIT_HELP
End If
If SPL1T
Pop Proc
End If
' then check for doubles
If PL4YER_COUNT(HAND)+(SOFT(HAND)*10)<12
D0UBLE=False
If PL4YER_COUNT(HAND)+(SOFT(HAND)*10)<9 and SOFT(HAND)
SOFT_DOUBLE_HELP
End If
If PL4YER_COUNT(HAND)>8 and Not SOFT(HAND)
HARD_D0UBLE_HELP
End If
If D0UBLE
Pop Proc
End If
End If
End If
' Then look at soft hands
If SOFT(HAND)
SOFT_HIT_HELP
Else
HARD_HIT_HELP
End If
'
End Proc
Procedure LIGHT[ADVICE]
Shared AN$
Sprite 1,185,137+ADVICE*16,65
Channel 9 To Sprite 1
Amal 9,AN$
Amal On 9
End Proc
Procedure _LOAD_ARRAY
Shared SPEED_ARR$()
For S=0 To 2
Read SPEED_ARR$(S)
Next S
Data "Fast","Med.","Slow"
End Proc
Procedure MAKE_CHIP_PILE[BET]
RED_CHIPS=BET mod 5 : BLUE_CHIPS=Int(BET/5)
If BET=0 Then RED_CHIPS=0
End Proc
Procedure MAKE_PACK
Shared CARD_PACK$()
CARD=1
For P4CK=1 To 4
For RANK=1 To 13
For SUIT=0 To 3
CARD_PACK$(CARD)=Str$(SUIT)+Str$(RANK)
Inc CARD
Next SUIT
Next RANK
Next P4CK
End Proc
Procedure M0USE_CHIP_MOVE
Rem get chips to follow pointer
Shared RED_CHIPS,BLUE_CHIPS,B0B
If RED_CHIPS>0
Bob B0B+1,X Screen(X Mouse),Y Screen(Y Mouse)-BLUE_CHIPS*2-1,RED_CHIPS
Else
Bob Off B0B+1
End If
If BLUE_CHIPS>0
Bob B0B,X Screen(X Mouse),Y Screen(Y Mouse),BLUE_CHIPS+4
Else
Bob Off B0B
End If
End Proc
Procedure PAY_EVENS
Shared DUBBLED()
TEMP_FL=DUBBLED(HAND)
BANK=BANK+STAKE(HAND)*2
B0B=B0B+HAND
If HAND=2 Then HAND=3
Channel 1 To Bob B0B
Channel 2 To Bob B0B+1
If BLUE_CHIPS>0
Bob B0B,0,0,I Bob(1)
AM$="Move"+Str$(X Bob(HAND))+"-20,"+Str$(Y Bob(HAND))+"-16,40"
Amal 1,AM$
End If
If RED_CHIPS>0
Bob B0B+1,0,0,I Bob(2)
AM$="Move"+Str$(X Bob(HAND+1))+"-20,"+Str$(Y Bob(HAND+1))+"-16,40"
Amal 2,AM$
End If
If TEMP_FL and BLUE_CHIPS>0
Bob B0B+2,0,0,I Bob(HAND+4)
AM$="Move"+Str$(X Bob(HAND+4))+"-20,"+Str$(Y Bob(HAND+4))+"-16,40"
Channel 3 To Bob B0B+2 : Amal 3,AM$
End If
If TEMP_FL and RED_CHIPS>0
Bob B0B+3,0,0,I Bob(HAND+5)
AM$="Move"+Str$(X Bob(HAND+5))+"-20,"+Str$(Y Bob(HAND+5))+"-16,40"
Channel 4 To Bob B0B+3 : Amal 4,AM$
End If
If HAND=3 Then HAND=2
Amal On
While Chanmv(1) or Chanmv(2) or Chanmv(3) or Chanmv(4)
Wend
Wait 35
End Proc
Procedure PAY_SIX_TO_4
Shared BET
Inc B0B
Channel 1 To Bob B0B
Channel 2 To Bob B0B+1
Channel 3 To Bob B0B+2
Channel 4 To Bob B0B+3
BANK=BANK+STAKE(HAND)+(STAKE(HAND)*1.5)
If BLUE_CHIPS>0
BLUE_X=X Bob(1) : BLUE_Y=Y Bob(1)
Bob B0B,0,0,I Bob(1)
AM$="Move"+Str$(BLUE_X)+"-20,"+Str$(BLUE_Y)+",40"
Amal 1,AM$
End If
If RED_CHIPS>0
RED_X=X Bob(2) : RED_Y=Y Bob(2)
Bob B0B+1,0,0,I Bob(2)
AM$="Move"+Str$(RED_X)+"-20,"+Str$(RED_Y)+",40"
Amal 2,AM$
End If
BET2=BET/2
If STAKE(HAND) mod 2=1
If OWES_50P
Inc BET2
Inc BANK
OWES_50P=False
Else
OWES_50P=True
End If
End If
If BET2>0
MAKE_CHIP_PILE[BET2]
If BLUE_CHIPS>0
Bob B0B+2,0,0,4+BLUE_CHIPS
AM$="Move"+Str$(BLUE_X)+"-40,"+Str$(BLUE_Y)+",40"
Amal 3,AM$
End If
If RED_CHIPS>0
Bob B0B+3,0,0,RED_CHIPS
AM$="Move"+Str$(Max(BLUE_X,RED_X))+"-40,"
AM$=AM$+Str$(Max(BLUE_Y,RED_Y))+"-5,40"
Amal 4,AM$
End If
End If
Amal On
While Chanmv(1) or Chanmv(2) or Chanmv(3) or Chanmv(4)
Wend
Wait 30
End Proc
Procedure PLACE_BET
Shared TLX(),TLY(),BRX(),BRY(),BET,WHERE,RESTART
BET_PLACED=False
BET=0
_UPDATE_BANK
Repeat : Rem incre/decrement bet until bet is placed
Z=Mouse Zone : K=Mouse Key
Wait 6
If K<>0
If Z=5
If K=1
If BET<25
Inc BET
Dec BANK
_UPDATE_BANK
End If
End If
If K=2
If BET>0
Dec BET
Inc BANK
_UPDATE_BANK
End If
End If
End If
If Z=6
If K=1
If BET<21
BET=BET+5
BANK=BANK-5
_UPDATE_BANK
End If
End If
If K=2
If BET>4
BET=BET-5
BANK=BANK+5
_UPDATE_BANK
End If
End If
End If
End If
MAKE_CHIP_PILE[BET]
M0USE_CHIP_MOVE
Wait Vbl
If K=1 and Z=7 and BET>0
BET_PLACED=True
End If
Until BET_PLACED or Key State(69)=True
If Key State(69)=True Then RESTART=True
If BET mod 5=0 Then Bob Off B0B+1 : Rem loose a loose sprite.
Wait 10 : Rem this stops the mouse press carrying thru to next test.
End Proc
Procedure _PROCESS[G$]
Screen Open 4,640,200,4,Hires
Curs Off
Restore G$
A$=""
LINE=0
While A$<>"**"
Read A$
Locate 0,LINE
If A$="*"
Print " "
Print " Press a key."
Wait Key
Cls
LINE=0
Else
Print A$
Inc LINE
End If
Wend
Screen Close 4
RULES:
Data " Rules of the House."
Data " ==================="
Data " "
Data "1. Four decks of cards are used, and after each shuffle approximately"
Data " 12 cards are 'burned' from the bottom of the pack."
Data " Each card has its face value. Court cards count as ten. Aces count"
Data " as either 1 or 11, whichever is to the hand's advantage."
Data " "
Data "2. The player must bet before any cards are dealt."
Data " "
Data "3. All cards are dealt face up. The dealer will deal two cards to the"
Data " player and one to himself. Only after the player has completed his"
Data " hand will the dealer deal more cards to himself."
Data " "
Data "4. Any hand with a count of over 21 is 'bust'."
Data " "
Data "5. Dealer stands on a hand of 17 or more, whether hard or soft."
Data " "
Data "6. Dealer hits a hand of 16 or less."
Data "*"
Data "7. Player may stand at any time."
Data " "
Data "8. Player may double his bet after the second card but may not increase"
Data " his bet thereafter."
Data " "
Data "9. Player may split his hand if his first two cards are of equal value"
Data " except in the case of Court Cards and tens. Only one split is"
Data " permitted per hand."
Data " "
Data " Note: Although casinos allow splitting on tens and pairs of Court"
Data " cards, this will not be offered in this program. This is"
Data " not a disadvantage to the player, because Standing on 20"
Data " is far better than splitting tens."
Data "*"
Data " "
Data "10. Drawn hands (Standoffs) will be treated as 'No Bet'."
Data " "
Data "11. A player winning with a Blackjack (an Ace a ten or a Court card)"
Data " will be paid one and a half times his stake, except in split hands,"
Data " when the player will be paid 'evens'."
Data " (As there are no 50p chips, in the case of Blackjack on a bet of an"
Data " odd amount, the extra 50p will be added to the next similar payout"
Data " thus rounding it up.)"
Data " "
Data "12. In the event of the dealer getting Blackjack the dealer wins unless the"
Data " player has Blackjack, in which case it will count as 'no bet'."
Data "*"
Data "**"
_INSTRUCT:
Data " INSTRUCTIONS."
Data " ============="
Data " The Game."
Data " ---------"
Data " The player must place a bet before any cards are dealt. To do this"
Data " use the mouse to pick up chips from either or both of the two boxes"
Data " marked '�1' and '�5'. The left mouse button will pick up chips"
Data " (increase the bet); the right button will drop chips (decrease the"
Data " bet)."
Data " "
Data " To place the bet simply move the chips into the betting box and press"
Data " the left button."
Data " "
Data " The dealer will deal two cards to the player and one to himself."
Data " It is now up the player make his choice of 'Stand', 'Hit', 'Double', or"
Data " 'Split' where allowable."
Data " "
Data " The object of the gane, for both player and dealer, is to get as high"
Data " a score as possible without going over 21."
Data "*"
Data " Once the player has either bust (gone over 21) or stood (stopped"
Data " drawing cards) on all his hands the dealer will deal his hand"
Data " according to the rules."
Data "*"
Data " "
Data " OPTIONS."
Data " ========"
Data " "
Data " If 'Play with Help' has been selected from the Options menu, one"
Data " of the four red lights beside the play buttons will flash. This is"
Data " the advised play for the player's card count, having taken the dealer's"
Data " card into consideration."
Data " "
Data " If 'Play without Help' has been selected, advice is still available"
Data " from the 'Help' key."
Data " "
Data " The advice is based on accepted optimum strategy based purely on the"
Data " player's and the dealer's hands. NOT on any assumption or sneaky"
Data " knowledge of what the next card may be."
Data " "
Data " The 'Select Speed' option allows the player to vary the speed that the"
Data " cards are dealt."
Data " "
Data " Pressing <Esc> during play will return player to the Menu Screen."
Data "*"
Data "**"
COUNT:
Data " CARD COUNTING."
Data " =============="
Data " The theory is that, by counting the cards played, one can assess"
Data " whether the latter half of each pack is loaded towards the dealer"
Data " or towards the player. The size of the stakes are adjusted"
Data " accordingly."
Data " "
Data " The card counting strategy is more effective when only one deck of"
Data " cards is used. However, in the U.K., four decks are always used and,"
Data " as an additional deterrent, the last 15 or so cards are 'BURNED' after"
Data " each shuffle. The dealer does this by inserting a blank card into"
Data " the pack about a quarter of an inch from the bottom. When the blank"
Data " card is reached, the pack is reshuffled."
Data " "
Data " Having said that, here are two strategies you may like to try."
Data "*"
Data " Aces."
Data " As the relative number of aces remaining in the pack increases,"
Data " so does the chance of a Blackjack or of splitting on two aces."
Data " If the ace count is low - increase the bet."
Data " "
Data " Fives."
Data " The fewer fives there are left in the pack, the more likely the"
Data " dealer is to 'BUST'. So if a lot of fives come out, increase the"
Data " stake and take fewer chances with 'BUSTING' yourself."
Data " "
Data "*"
Data "**"
STRATEGY:
Data " Strategy"
Data " ========"
Data ""
Data " "
Data " At first glance the dealer has an enormous advantage in"
Data " Blackjack, because he does not have to draw cards to his hand"
Data " until all the players have either Stood or Bust. So that if"
Data " both the player and the dealer bust, the dealer wins on what"
Data " is, in effect, a draw."
Data " "
Data " To counter-balance this the player is allowed to Stand at"
Data " any time, whereas the dealer MUST Hit a hand of sixteen or"
Data " less. In addition, the player is given the opportunity to"
Data " increase his stake when the cards are in his favour, and"
Data " the player gets paid at odds of six to four on a Blackjack."
Data "*"
Data " "
Data " It follows that a knowledge of what are 'good' and what"
Data " are 'bad' hands will help your money go that much further"
Data " and, who knows, one day you may actually win something."
Data " "
Data " There follows a table of what this program will train you"
Data " to do."
Data " "
Data " (Note: The term 'Hard hand' refers to hand which does not"
Data " have any aces in it or a Soft hand which has gone over 21.)"
Data "*"
Data " "
Data " PLAYER PLAY"
Data " ====== ===="
Data " "
Data " Hitting on Hard Hands"
Data " "
Data " Less than 12 Always Hit. Cannot Bust."
Data " 12 Hit when dealer has 2 or 3."
Data " 12 - 16 Hit when dealer has more than 6."
Data " "
Data " Hitting Soft Hands"
Data " "
Data " 18 (Ace+7) Hit when dealer has 9 or 10."
Data " Less than 18 Always Hit."
Data "*"
Data " "
Data " PLAYER PLAY"
Data " ====== ===="
Data " "
Data " Doubling Hard Hands"
Data " "
Data " 11 Always Double."
Data " 10 When dealer has 2-9"
Data " 9 When dealer has 2-6"
Data " "
Data " Doubling Soft Hands"
Data " "
Data " 13 to 16 When dealer has 4-6"
Data " 17 When dealer has 2-6"
Data " 18 When dealer has 3-6"
Data "*"
Data " "
Data " PLAYER PLAY"
Data " ====== ===="
Data ""
Data " Splitting"
Data " "
Data " Aces and 8s Always Split."
Data " 10s and 5s Never Split. (You wont be offered 10s)"
Data " 9s Not when dealer has 7,10 or Ace."
Data " 7s When dealer has 2-8."
Data " 6s When dealer has 2-7."
Data " 4s When dealer has 5."
Data " 3s and 2s When dealer has 2-7."
Data "*"
Data "**"
DETAILS:
Data " Blackjack Trainer is written by Peter Cartwright in AMOS."
Data " "
Data " This is Version 1.0 and has not been heavily play tested (although"
Data " I have done my best!), so any bug reports, suggestions and help"
Data " will be most welcome."
Data " "
Data " Address any comments, brickbats or donations to:"
Data " "
Data " Peter Cartwright,"
Data " 68a Dornton Road,"
Data " London. SW12 9NE."
Data " 081 673 0971."
Data " "
Data " Possible later additions: Card counting strategy, user-defined"
Data " Hitting strategy and automatic test runs. i.e. Letting the Amiga"
Data " play x thousand hands using a given strategy and report results."
Data "*"
Data "**"
End Proc
Procedure SPLIT_HELP
Shared HARD_DBL(),SOFT_DBL(),HARD_HIT(),SOFT_HIT(),SPLIT(),SPL1T
' 101 to 200 SPLIT_HELP
_OFFSET=99
PL4Y=PL4YER_COUNT(HAND)/2 : DEAL=DEALER_COUNT-1
If PL4Y>6
PL4Y=PL4Y-(PL4Y-6)*2
Else
If PL4Y<>6
PL4Y=PL4Y+(6-PL4Y)*2
End If
End If
SEL=Peek(Start(8)+_OFFSET+(PL4Y-1)*10+DEAL)
If SEL=1
LIGHT[3]
SPL1T=True
End If
End Proc
Procedure SOFT_HIT_HELP
Shared HARD_DBL(),SOFT_DBL(),HARD_HIT(),SOFT_HIT(),SPLIT()
' 1 to 40 Soft_HIT
_OFFSET=-1
DEAL=DEALER_COUNT-1
If PL4YER_COUNT(HAND)>16
PL4Y=PL4YER_COUNT(HAND)-16
If PL4Y>4 : Rem this stops 21 overflowing the array
PL4Y=4 : Rem but gives the same advice
End If
SEL=Peek(Start(8)+_OFFSET+(PL4Y-1)*10+DEAL)
If SEL=1
LIGHT[2]
Else
LIGHT[1]
End If
Else
LIGHT[2]
End If
End Proc
Procedure SOFT_DOUBLE_HELP
Shared HARD_DBL(),SOFT_DBL(),HARD_HIT(),SOFT_HIT(),SPLIT(),D0UBLE
' 201 to 270 SOFT_DBL
_OFFSET=199
PL4Y=19-PL4YER_COUNT(HAND) : DEAL=DEALER_COUNT-1
SEL=Peek(Start(8)+_OFFSET+(PL4Y-1)*10+DEAL)
If SEL=1
LIGHT[4]
D0UBLE=True
End If
End Proc
Procedure SET_ZONES
Shared TLX(),TLY(),BRX(),BRY()
For I=1 To 3 : Read TLX(I) : Read TLY(I)
Read BRX(I) : Read BRY(I) : Next I
Ink 1
For I=1 To 3
Box TLX(I),TLY(I) To BRX(I),BRY(I)
Set Zone I+4,TLX(I),TLY(I) To BRX(I),BRY(I)
Next I
For I=0 To 3
Set Zone I+1,3,106+16*I To 53,122+16*I
Wait Vbl
Next I
Data 130,174,162,194
Data 161,174,194,194
Data 142,104,175,158
End Proc
Procedure SHUFFLE
Shared CARD_PACK$()
Text 0,20,"SHUFFLING"
For I=1 To 5
Sam Play 1,3,9800
Wait 40
Next I
Randomize Timer
For I=208 To 2 Step -1
J=Rnd(I)
CARD_PACK$(0)=CARD_PACK$(J)
CARD_PACK$(J)=CARD_PACK$(I)
CARD_PACK$(I)=CARD_PACK$(0)
Next I
Text 0,20," "
End Proc
Procedure _SPLIT_PROC
Shared PL0FFSETX,PL0FFSETY,PL4YERX(),PL4YERY,SPLIT,RANK,ADVICE_GIVEN
Shared SPLIT_POSSIBLE
SPLIT=True
SPLIT_POSSIBLE=False : Rem Only one split allowed
Dec POS : Dec POS
BANK=BANK-STAKE(HAND)
Text 200,186,"�"+Str$(BANK)
'Follow PL4YER_COUNT(1),PL4YER_COUNT(2),SOFT(1),SOFT(2)
PL4YER_COUNT(1)=RANK
PL4YER_COUNT(2)=RANK
SOFT(HAND+1)=SOFT(HAND)
NUM_OF_ACES(1)=1
NUM_OF_ACES(2)=1
STAKE(2)=STAKE(1)
' Move bottom card across
Channel 1 To Bob B0B
AM$="Move -106,-8,40"
Amal 1,AM$ : Amal On
While Chanmv(1)
Wend
Wait 20
If BLUE_CHIPS>0
_YOFFSET=186-Y Bob(1)
Else
_YOFFSET=186-Y Bob(2)
End If
AM$="Move 36,0,20"
AM2$="Move -64,-"+Str$(_YOFFSET)+",20"
Channel 1 To Bob 1
Channel 2 To Bob 2
Channel 3 To Bob 3
Channel 4 To Bob 4
Inc POS
'place extra chips
If RED_CHIPS>0
Bob 4,160,186-BLUE_CHIPS*2,I Bob(2)
Amal 2,AM$
Amal 4,AM2$
End If
If BLUE_CHIPS>0
Bob 3,160,186,I Bob(1)
Amal 1,AM$
Amal 3,AM2$
End If
Amal On
While Chanmv(1)
Wend
' Deal one card to each hand '
For I=1 To 2
PL0FFSETX=PL4YERX(I) : PL0FFSETY=PL4YERY
DEAL_CARD
ADJUST_HAND[I]
PL4YER_COUNT(I)=PL4YER_COUNT(I)+RANK
' check that it's not 2 aces
If PL4YER_COUNT(I)>21
PL4YER_COUNT(I)=PL4YER_COUNT(I)-10
Dec NUM_OF_ACES(I)
End If
Wait 5
Next I
' Hand points to first hand
Bob 30,225,15,63
Wait Vbl
Bell
Wait 40
Inc POS
PL0FFSETX=PL4YERX(1)
ADVICE_GIVEN=False
End Proc
Procedure TAKE_MONEY
Shared DUBBLED()
TEMP_FL=DUBBLED(HAND)
If HAND=2 Then HAND=3
Channel 1 To Bob HAND
Channel 2 To Bob HAND+1
AM$="Move -70,-160,20"
If BLUE_CHIPS>0 Then Amal 1,AM$
If RED_CHIPS>0 Then Amal 2,AM$
' take care of doubles
If TEMP_FL and BLUE_CHIPS>0
Channel 3 To Bob HAND+4 : Amal 3,AM$
End If
If TEMP_FL and RED_CHIPS>0
Channel 4 To Bob HAND+5 : Amal 4,AM$
End If
Amal On
If HAND=3 Then HAND=2
Wait 50
End Proc
Procedure _UPDATE_BANK
Text 200,186,"�"+Str$(BANK)+" "
End Proc